package com.fire.activiti.activitidb.process.adapter;

import org.activiti.engine.cfg.ProcessEngineConfigurator;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 扩展-适配多数据库
 * @author Mr.Fire
 */
@Component
public class ActivitiEngineConfiguration implements ActivitiEngineConfigurationConfigurer {

    /**
     * 设置DbSqlSessionConfigurator
     */
    @Autowired
    private DbSqlSessionConfigurator dbSqlSessionConfigurator;

    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        //设置数据库类型
        processEngineConfiguration.setUsingRelationalDatabase(false);
        List<ProcessEngineConfigurator> configurators = new ArrayList<ProcessEngineConfigurator>();
        configurators.add(dbSqlSessionConfigurator);
        processEngineConfiguration.setConfigurators(configurators);
    }

}